<!--sidebar-menu-->
<div id="sidebar" class="clearfix"><!-- <a href="#" class="visible-phone"><i class="icon icon-home"></i> Dashboard</a> -->
  <ul style="display: block;">
  {% include "common/menu.html" %}
  </ul>
</div>
<!--end sidebar-menu-->

<div id="content">
  
    <div class="container-fluid" style="padding: 0;">
      <div class="widget-box tab-tabs" >
          <div class="widget-title">
              <ul class="nav nav-tabs">
                  {% include "common/tab.html" %}
              </ul>
          </div>
          <div class="widget-content tab-content">

            <div id="tab3" class="tab-pane active">
              <div class="container-fluid">
                <div class="row-fluid" style="margin: 20px 0;overflow: hidden;">  
                  <span style="font-size:20px;">配置默认的主播获得的分成比例</span>
                </div>
                
                <div class="row-fluid">
                  <div class="content-box">
                    <div class="fontsize20" style="margin: 10px 0 10px 20px;">
                      <button class="btn btn-purple" onclick="ruleDialog('添加规则')" >添加规则</button>
                      <span>配置分成比例的规则，配置时请注意规则之间的冲突</span>
                    </div>

                    <table id="tableList" class="table with-check table-purple" style="border: 0; margin-bottom: 0;">
                      <thead>
                        <tr>
                          <th>规则</th>
                          <th>分成比例</th>                       
                          <th></th>
                        </tr>
                      </thead>
                      <tbody>
                      </tbody>
                    </table>

                  </div>

                  <div class="row-fluid" style="margin-top: 10px;">
                      <div id="pagination" class="pagination alternate pull-right">
                      </div>
                  </div>
                  
                  
                  <div class="row-fluid" style="margin: 20px 0;overflow: hidden;">  
                    <span style="font-size:20px;">
                    例外的主播（单独配置TA获得的分成比例）
                    </span>
                  </div>
                  <div class="content-box" >
                    <form id="exceptionRuleSearch" class="form-search">
                      <div class="fontsize20" style="margin: 10px 0 10px 1.32766%;">
                        <button class="btn btn-purple"  onclick="addExceptionDialog('添加例外的主播')" type="button" >添加</button>
                        
                        <span class="find-search pull-right" style="margin-right: 20px;">
                        <i class="icon-search icon-on-right bigger-110"></i>
                        <input name="name" type="text" placeholder="用户名或昵称" >
                        <button id="btn_exceptionRulesearch" type="button" class="btn btn-purple">查询&nbsp;</button>
                        </span>
                      </div>
                  </form>
                    
                    <ul id="exceptionListRule" class="thumbnails">

                    </ul>
                  </div>

                    <div class="row-fluid" style="margin-top: 10px; " >
                        <div id="pagination2" class="pagination alternate pull-right"></div>
                    </div>

                </div>
                
                
              </div>           
            
            </div>
            

         </div>
        </div>
    
    </div>

</div>


{% include "common/rule_dialog.html" %}
{% include "common/addanchor_dialog.html" %}
{% include "common/addexception_dialog2.html" %}
{% include "common/changescale_dialog.html" %}


<link rel="stylesheet" href="{{static_url('web/css/jquery.range.css')}}">
<script type="text/javascript" src="{{static_url('web/js/jquery.range.js')}}"></script>
<script type="text/javascript" src="{{static_url('web/js/91ns.anchor.js')}}"></script>
<script type="text/javascript" src="{{static_url('web/js/91ns.bonus.js')}}"></script>

<script type="text/javascript">

    function exchangeDilog(){
      $('#exchangeDilog').dialog({
          autoOpen:true,
          width:320,
          height:220,
          title:'配置默认的主播的聊币兑换下限',
          resizable:false,
          modal:true,
          open:function(){
             var limitNum= $('#limitNum').text();
              $('#exchenge-modfiy').val(limitNum);

          },
          buttons: {
            "确定": function () {

              var data={};
              data.value=$('#exchenge-modfiy').val();
 
              $.ajax({
                type:"POST",
                data:data,
                url:'/ajax/editExchange',
                dataType:'json',
                success:function(res){
                  var data=res.data;
                  if(res.code==0){
                    location.reload();
                  }else{
                    alert(res.info)
                  }

                }
              });

            }

          }
      });
    }

    function applyTeb () {
      $('#applySearch .tabs-group').click(function(){
        $('#applySearch .tabs-group').removeClass('active');
        $(this).addClass('active');
        var applySearch= document.getElementById('applySearch');
        applySearch.status.value=$(this).attr('status');
        getDataApplyList();
      })
    }

  //获得签约主播数据集
  function getDataApplyList(index){
    var applySearch= document.getElementById('applySearch'),
    data={};
    data.status=applySearch.status.value==''?'0':applySearch.status.value;
    data.namelike='';
    data.page=index||1;
    data.pageSize=global.pageSize;
    $.ajax({
      type:"POST",
      data:data,
      url:'/ajax/anchorApplyList',
      dataType:'json',
      success:function(res){
        var data=res.data.data;

        var tableList=document.getElementById("tableListApply");
        var tbody= tableList.getElementsByTagName('tbody')[0];
        dataTable.clearData(tbody);

        var applyCount=document.getElementById('applyCount');
        applyCount.innerHTML=data.count;

        for(var i=0;i<data.list.length;i++){
          addRowApply(tbody,'',data.list[i]);
        }

        if(!index||index==0){
          initPaginationApply(data.count);
        }

      }
    });

  }

  function initPaginationApply(page){
    $("#paginationApply").pagination(page, {
          callback: applyCallback,
          items_per_page:global.pagesize, // 每页只显示一条记录
          num_display_entries : 3,
          num_edge_entries : 1, 
          prev_text : "上一页",  
          next_text : "下一页"
      });
  }

  function applyCallback(page_index, jq){
      getDataApplyList(page_index)
      return false;
  }

  function addRowApply(table,index,data){
    var row=table.insertRow();
    var cell=row.insertCell(0);
    var cell1=row.insertCell(1);
    var cell2=row.insertCell(2);
    var cell3=row.insertCell(3);
    var cell4=row.insertCell(4);
    var cell5=row.insertCell(5);
    var cell6=row.insertCell(6);
    
    cell.innerHTML=data.uid;

    var div=document.createElement("div"),
    img=document.createElement("img"),
    span=document.createElement("span");

    div.className="anchor-info";
    img.src=global.contract+data.avatar;
    span.innerHTML=data.uid;

    div.appendChild(img);
    div.appendChild(span);

    cell1.appendChild(div);

    cell2.innerHTML=data.level2;
    cell3.innerHTML=data.fans;
    
    cell4.innerHTML=data.createTime;
    
    //0.申请中 1.同意 2.取消 3.拒绝
    cell5.innerHTML=data.status=='0'?'申请中...':data.status==1?'同意':data.status==2?'取消申请':data.status==3?'拒绝':'';

    var a=document.createElement("a");
    a.href='/anchor/applyinfo?id='+data.id;
    a.innerHTML="查看";
    a.className="a-edit font font18 cr-pe cursor-pointer";
    cell6.appendChild(a);
  return row;
}
</script>